home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl / 5.10.0 / ExtUtils / CBuilder / Platform / Unix.pm < prev    next >
Encoding:
Perl POD Document  |  2009-06-26  |  968 b   |  38 lines

  1. package ExtUtils::CBuilder::Platform::Unix;
  2.  
  3. use strict;
  4. use ExtUtils::CBuilder::Base;
  5.  
  6. use vars qw($VERSION @ISA);
  7. $VERSION = '0.21';
  8. @ISA = qw(ExtUtils::CBuilder::Base);
  9.  
  10. sub link_executable {
  11.   my $self = shift;
  12.   # $Config{cc} is usually a better bet for linking executables than $Config{ld}
  13.   local $self->{config}{ld} =
  14.     $self->{config}{cc} . " " . $self->{config}{ldflags};
  15.   return $self->SUPER::link_executable(@_);
  16. }
  17.  
  18. sub link {
  19.   my $self = shift;
  20.   my $cf = $self->{config};
  21.   
  22.   # Some platforms (notably Mac OS X 10.3, but some others too) expect
  23.   # the syntax "FOO=BAR /bin/command arg arg" to work in %Config
  24.   # (notably $Config{ld}).  It usually works in system(SCALAR), but we
  25.   # use system(LIST). We fix it up here with 'env'.
  26.   
  27.   local $cf->{ld} = $cf->{ld};
  28.   if (ref $cf->{ld}) {
  29.     unshift @{$cf->{ld}}, 'env' if $cf->{ld}[0] =~ /^\s*\w+=/;
  30.   } else {
  31.     $cf->{ld} =~ s/^(\s*\w+=)/env $1/;
  32.   }
  33.   
  34.   return $self->SUPER::link(@_);
  35. }
  36.  
  37. 1;
  38.